

	$(document).ready(function() {
		init(1,"","","","");
	});
	function init(pageNo,time,phoneNumber,userName) {
		$("#thislist").html("");
		$.ajax({
			url: urlcore + "/api/channel/findMyMember?phone=" + phoneNumber + "&source=" + userName + "&pageNo=" + pageNo+ "&pageSize=10"+"&time="+time,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {

				if(data.success == true) {
					$.each(data.data.list, function(i, n) {
						var realName="未知",source="未知";
						if(n.realName!=null){
							realName=n.realName;
						}
						if(n.source!=null){
							source=n.source;
						}
						var thislist =
							'<tr class="footable-even" style="display: table-row;">' +
//							'<td class="footable-visible"><input type="checkbox" /></td>' +
							'<td class="footable-visible">' + n.id + '</td>' +
							'<td class="footable-visible">' + realName + '</td>' +
							'<td class="footable-visible">' +n.phone+'</td>' +
							'<td class="footable-visible">' + n.authStatus + '</td>' +
							'<td class="footable-visible">' + new Date(n.gmtDatetime).pattern("yyyy-MM-dd HH:mm:ss") + '</td>' +
							'<td class="footable-visible">' + n.source + '</td>' +
							'<td class="footable-visible footable-last-column">'+
							'</tr>';
						$('#thislist').append(thislist);
					});
					$('#totalPeople').text(data.data.total);
					$("#pager").pager({
						pagenumber: pageNo,
						pagecount: data.data.pages,
						totalcount: data.data.total,
						buttonClickCallback: PageClick
					});

				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;

					if(thisUrl.indexOf('login.html') <= -1) {
						top.window.location.href = "login.html";
					}

				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
	}
	PageClick = function(pageclickednumber) {
		var applyTime=$("#applyTime").val();
		var source = $('#loginName').val();
		init(pageclickednumber,applyTime,"",source);
	}


function EnterSearchList() {
	var code = event.keyCode;
	if(code == 13) {
		searchList();
	}

}

function searchList() {
	var applyTime=$("#applyTime").val();
	var source = $('#loginName').val();
	  init(1,applyTime,"",source);
}

//导出表格
function excal() {
	var gmtDateTime=$("#applyTime").val();
	var phoneNumber = $('#phoneNumber').val();
	var userName = $('#userName').val();
	$.ajax({
		url: urlcore + "/api/channel/makeExcle?userName="+""+"&phoneNumber="+""+"&gmtDateTime="+gmtDateTime,
		type: "GET",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success: function(data) {
			if(data.success == true) {
				var url1 =  data.data.toString().slice(4);
				location.href="https"+url1;
			} else {
				alert(data.msg);
			}
		},
		error: function() {
			alert("error");
		}
	});
}